import { Column, Entity, Index } from "typeorm";

@Index("idx_sd_depart_order", ["order"], {})
@Index("idx_sd_org_code", ["orgCode"], {})
@Index("idx_sd_parent_id", ["parentId"], {})
@Index("uniq_depart_org_code", ["orgCode"], { unique: true })
@Entity("sys_depart", { schema: "workflow" })
export class SysDepart {
    @Column("char", { primary: true, name: "id", comment: "ID", length: 36 })
    id: string;

    @Column("char", {
        name: "parent_id",
        nullable: true,
        comment: "\t 上级部门ID",
        length: 36,
    })
    parentId: string | null;

    @Column("varchar", { name: "name", comment: "部门名称", length: 100 })
    name: string;

    @Column("varchar", {
        name: "name_en",
        nullable: true,
        comment: "英文名",
        length: 100,
    })
    nameEn: string | null;

    @Column("varchar", {
        name: "name_abbr",
        nullable: true,
        comment: "缩写",
        length: 50,
    })
    nameAbbr: string | null;

    @Column("int", {
        name: "order",
        nullable: true,
        comment: "排序",
        default: () => "'0'",
    })
    order: number | null;

    @Column("varchar", {
        name: "description",
        nullable: true,
        comment: "描述",
        length: 500,
    })
    description: string | null;

    @Column("varchar", {
        name: "org_category",
        comment: "机构类别 1公司，2组织机构，2岗位",
        length: 10,
        default: () => "'1'",
    })
    orgCategory: string;

    @Column("varchar", {
        name: "org_type",
        nullable: true,
        comment: "机构类型 1一级部门 2子部门",
        length: 10,
    })
    orgType: string | null;

    @Column("varchar", {
        name: "org_code",
        unique: true,
        comment: "机构编码",
        length: 64,
    })
    orgCode: string;

    @Column("char", {
        name: "mobile",
        nullable: true,
        comment: "手机号",
        length: 36,
    })
    mobile: string | null;

    @Column("char", { name: "fax", nullable: true, comment: "传真", length: 36 })
    fax: string | null;

    @Column("varchar", {
        name: "address",
        nullable: true,
        comment: "地址",
        length: 100,
    })
    address: string | null;

    @Column("varchar", {
        name: "remark",
        nullable: true,
        comment: "备注",
        length: 100,
    })
    remark: string | null;

    @Column("tinyint", {
        name: "status",
        nullable: true,
        comment: "状态（1启用，0不启用）",
        width: 1,
        default: () => "'1'",
    })
    status: boolean | null;

    @Column("tinyint", {
        name: "del_flag",
        nullable: true,
        comment: "删除状态（0，正常，1已删除）",
        width: 1,
        default: () => "'0'",
    })
    delFlag: boolean | null;

    @Column("char", {
        name: "create_by",
        nullable: true,
        comment: "创建人",
        length: 36,
    })
    createBy: string | null;

    @Column("datetime", {
        name: "create_time",
        nullable: true,
        comment: "创建日期",
    })
    createTime: Date | null;

    @Column("char", {
        name: "update_by",
        nullable: true,
        comment: "更新人",
        length: 36,
    })
    updateBy: string | null;

    @Column("datetime", {
        name: "update_time",
        nullable: true,
        comment: "更新日期",
    })
    updateTime: Date | null;
}
